package com.sikaryofficial.backend.manager;

import com.sikaryofficial.backend.domain.entity.ActivityAttendRec;
import com.sikaryofficial.backend.service.IActivityAttendRecService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author : qinjinyuan
 * @desc : 活动奖项设置
 * @date : 2023/10/30 15:39
 */
@Service
@Slf4j
public class ActivityAttendManager {
    @Autowired
    private IActivityAttendRecService activityAttendRecService;

    /**
     * 活动参与记录
     *
     * @param activityId 活动ID
     * @param userId     用户ID
     * @param param      参数
     */
    @Async("asyncTaskExecutor")
    public void insertAttendRec(Long activityId, Long userId, String param) {
        ActivityAttendRec activityAttendRec = new ActivityAttendRec();
        activityAttendRec.setActivityId(activityId);
        activityAttendRec.setCreatedBy(userId);
        activityAttendRec.setCreatedTime(new Date());
        activityAttendRec.setParam(param);
        activityAttendRecService.save(activityAttendRec);
    }
}
